package jam.network.message;

import jam.model.*;
import jam.network.*;
import java.util.*;

public class ClientActionRemoveUC extends ClientCommand {
	protected static final String KEYWORD = "CA_REMUC";

	private String username;

	@Override
	public void process(ClientController controller) {
		NetworkController network = controller.getNetworkController();
		ClientModel client = controller.getModel();
		boolean success = false;
		if(client.isLoggedIn()) {
			success = client.getUser().deleteUserContact(username);
		}
		controller.send(new ServerResponse(this, success));
	}

	@Override
	protected String getKeyword() {
		return ClientActionRemoveUC.KEYWORD;
	}

	protected ClientActionRemoveUC(int transactionId, Scanner args) {
		super(transactionId);
		this.username = args.next();
	}
}
